package com.servlet;

import com.Dao.BookDao;
import com.bean.BookBean;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.IOException;
import java.util.ArrayList;

@WebServlet(name = "SelectBookServlet", value = "/SelectBookServlet")
public class SelectBookServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        request.setCharacterEncoding("UTF-8");
        response.setContentType("text/html;charset=UTF-8");
        String bookName = request.getParameter("name");
        BookDao bookdao = new BookDao();
        ArrayList<BookBean> list1 = bookdao.getLikeList(bookName);
        request.getSession().setAttribute("list1", list1);
        request.getRequestDispatcher("bookmassage.jsp").forward(request, response);
    }
}
